﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int missingNumber(int* nums, int numsSize) {
	/*int sum = (numsSize+1)*numsSize/2;
	for(int i = 0; i < numsSize; i++)
	{
		sum -= nums[i];
	}
	return sum;*/
	int s = 0;
	for (int i = 0; i < numsSize; i++)
	{
		s ^= nums[i];
	}
	for (int j = 0; j < numsSize + 1; j++)
	{
		s ^= j;
	}
	return s;

}
int main()
{
	int nums[9] = { 9,6,4,2,3,5,7,0,1 };
	int numsSize = sizeof(nums) / sizeof(nums[0]);
	printf("%d\n", missingNumber(nums, numsSize));
	return 0;
}